<?php
/**
 * Created by 底片云
 * Desc:奖项主页面
 * User:cbw
 * Date: 2020/11/29
 */
global $_G,$_P;
$system = $_G['system'];
$params = $_P;

$themeid = isset($params['themeid'])?$params['themeid']:'';//活动id
if($themeid <= 0){
    $themeid = Theme::getDefaultThemenew();
}
$theme = Theme::getThemeById($themeid);
if (!$theme){
    $response = show(40002);
    return  $response;
}
$config =   Theme::getConfig($themeid);
$system= $_G['system'];
$ac = !empty($params['ac'])?$params['ac']:'display';
$ltt_id = isset($params['ltt_id'])?$params['ltt_id']:'ltt_id';
$receive_list = getReceiveTodoAction();//领奖操作数组
if ($ac=='display'){
    $page_index = max(1,$params['page']);
    $page_size = 10;
    $page_total = intval(db_find("select count(*) as cnt from".tablename(t_lottery))['cnt']);
    if($page_total>0){
        $list = db_getall(t_lottery,['themeid'=>$themeid],[],'',[],[$page_index,$page_size]);
        $pager = pagination($page_total,$page_index,$page_size);
    }
}
if ($ac == 'edit'){
    $item = db_get(t_lottery,['ltt_id'=>$ltt_id]);
}

$return_clicent = get_defined_vars();
return view('/lt_main');